package cn.relx.basic.controller;

import cn.relx.basic.config.BussinessException;
import cn.relx.basic.service.VerifyCodeService;
import cn.relx.basic.util.AjaxResult;
import cn.relx.basic.vo.RegisterVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifyCode")
public class VerifyCodeController {
    @Autowired
    private VerifyCodeService verifyCodeService;

    @GetMapping("/image/{key}")
    public AjaxResult graph(@PathVariable("key") String key){
        String base64Str = verifyCodeService.graph(key);
        return AjaxResult.me().setResultObj(base64Str);
    }
    @PostMapping("/smsCode")
    public AjaxResult smsCode(@RequestBody RegisterVo vo){
        verifyCodeService.smsCode(vo);
        return AjaxResult.me().success();
    }
}
